
from flask import Flask, render_template, request
import os
import json
import pymysql
from mysql_storage import storage


template_path = os.path.join('templates')
app = Flask(__name__)


@app.route('/')
def hello_world():  # put application's code here

    return 'Hllo World!'


@app.route('/a', methods=["GET","POST"])
def a():  # put p[];'application's code here
    print('bbb')
    q = 'qqq'
    l = 'lll'
    if request.method == 'POST':
        print(request)
        print(request.method)
        print(request.form)
        print(json.dumps(request.form))
        # list = request.form.values()
        # for i in list:
        #     print(i)
        storage_list = storage()
        print(storage_list)
        print('------------------')
        print(list(storage_list))
        return list(storage_list)


    else:
        print('sb')
    return render_template('chaxun.html')


if __name__ == '__main__':
    app.run()
